<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	
<%@page import="com.lovo.bbs.vo.*,com.lovo.bbs.bo.*,java.util.*"%>

<%
    String asForumid = (String)request.getParameter("forumid");
    ForumVo data=null;
    if(!"".equals(asForumid)&&asForumid!=null){
        data =new ForumBo().getForumByForumID(Integer.parseInt(asForumid));
    }else{
       data=new ForumVo();
       data.setForumName("");
       data.setAboutForum("");
    }
	ArrayList<BoardVo> boardList = (ArrayList<BoardVo>)application.getAttribute("boardList");
	String boardSelect = (String) request.getParameter("boardSelect");
	String queryPage = (String) request.getParameter("queryPage");
	String asOpType = (String)request.getParameter("opType");
	int opType = 1;
	if(!"".equals(asOpType)&&asOpType!=null){
	   opType = Integer.parseInt(asOpType);
	}
	Iterator it;
	String[] processMod = { "增加论坛", "修改论坛", "删除论坛" };
%>
<html>
	<head>
		<link href="../../../css/admin.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../../../js/wbs_admin.js"></script>
		<script type="text/javascript">
		
		 function validate(){
      	 
       	   var msg=document.getElementById("errormsg");
       	   
       	   if(trim(document.frmMain.forumname.value)==""){            
              msg.innerHTML="<br><font color='red'>提示:请输入论坛名称</font>"    
              document.frmMain.forumname.focus();
              return false;
           }
       	   
           
           if(document.frmMain.boardid.value==""){            
              msg.innerHTML="<br><font color='red'>提示:请选择论坛默认所在版块</font>"    
              document.frmMain.boardid.focus();
              return false;
           }
           
           if(document.frmMain.forumread.value.length>400){            
              msg.innerHTML="<br><font color='red'>提示:内容过长</font>"    
              document.frmMain.boardid.focus();
              return false;
           }
         return true;  
        }
		
		</script>
	</head>
	<body >
		<form name="frmMain" action="ForumUpdateServlet" method="post" onSubmit="return validate();">
			<table class="navigation" style="width:98%" align="center">
				<tr>
					<td>
						当前位置: 论坛管理-->操作-->
						<font color="red"><%=processMod[opType - 1]%></font>
					</td>
				</tr>
			</table>
			<br>
			<table style="width:90%;" align="center">
				<div class="DialogBody">
					<div class="formArea">
						<div id="errormsg" class="DialogMsg"></div>
						<p>
							&nbsp;&nbsp;论坛名称:
							<input type="text" name="forumname" style="width:200px" maxlength="60" value="<%=data.getForumName()%>">
							(提示:可以名称前后加上符号,1~60字符)
						
						<p>
							论坛所属版块:
							<select name="boardid">
								<option value="">请选择</option>
							<%	if (boardList == null) {
									boardList = new ArrayList();
								}
								it = boardList.iterator();
								if (it != null) {
									while (it.hasNext()) {
										BoardVo boarData = (BoardVo) (it.next());
							%>
							<option value="<%=boarData.getBoardID()%>"><%=boarData.getBoardName()%></option>
							<%}}%>
							</select> (请选择论坛默认所在的版块)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<p>						
							论坛介绍:(设置论坛介绍信息,0~400字符)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<br>
							<textarea name="forumread" wrap=soft rows=8 cols=55><%=data.getAboutForum()%></textarea>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;														
						<p>
							<input type="submit" name="submit" class="button" value=" 确定 " onclick="validate();">
							<input type="button" name="button" class="button" value=" 取消 " onclick="preReturn();">
						<p>
							<br>
					</div>
				</div>
			</table>
			
			
			<input type="hidden" name="forumid" value="<%=data.getForumID()%>">
			<input type="hidden" name="opType" value="<%=opType%>">
			<input type="hidden" name="queryPage" value="<%=queryPage%>">
			
			<input type="hidden" name="boardSelect" value="<%=boardSelect%>">
		</form>
	</body>
</html>
